package com.GUI.lesson01;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class TestBorderLayout {
    public static void main(String[] args) {
        Frame frame = new Frame("TestBorderLayout");
        //添加按钮
        Button button = new Button("E");
        Button button1 = new Button("W");
        Button button2 = new Button("S");
        Button button3 = new Button("N");
        Button button4 = new Button("M");

        frame.add(button,BorderLayout.EAST);
        frame.add(button1,BorderLayout.WEST);
        frame.add(button2,BorderLayout.SOUTH);
        frame.add(button3,BorderLayout.NORTH);
        frame.add(button4,BorderLayout.CENTER);

        //设置可见
        frame.setVisible(true);
        //设置大小
        frame.setSize(200,200);
        //关闭
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }
}
